﻿using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;

namespace DBFirst.Models
{
    public partial class xjhdbContext : DbContext
    {
        public xjhdbContext()
        {
        }

        public xjhdbContext(DbContextOptions<xjhdbContext> options)
            : base(options)
        {
        }

        public virtual DbSet<SysDictionary> SysDictionary { get; set; }
        public virtual DbSet<SysOption> SysOption { get; set; }
        public virtual DbSet<SysSelect> SysSelect { get; set; }
        public virtual DbSet<SysUser> SysUser { get; set; }
        public virtual DbSet<UfSjbaoxiaoren> UfSjbaoxiaoren { get; set; }
        public virtual DbSet<User> User { get; set; }

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            if (!optionsBuilder.IsConfigured)
            {
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. See http://go.microsoft.com/fwlink/?LinkId=723263 for guidance on storing connection strings.
                optionsBuilder.UseSqlServer("Data Source=192.168.0.199;Initial Catalog=xjhdb;User ID=admin;Password=Sjtu@52580988;");
            }
        }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.Entity<SysDictionary>(entity =>
            {
                entity.HasNoKey();

                entity.Property(e => e.Id).ValueGeneratedOnAdd();

                entity.Property(e => e.Text)
                    .IsRequired()
                    .HasMaxLength(1000)
                    .IsUnicode(false);
            });

            modelBuilder.Entity<SysOption>(entity =>
            {
                entity.Property(e => e.Text)
                    .IsRequired()
                    .HasMaxLength(1000)
                    .IsUnicode(false);

                entity.HasOne(d => d.Select)
                    .WithMany(p => p.SysOption)
                    .HasForeignKey(d => d.Selectid)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_SysOption_SysSelect");
            });

            modelBuilder.Entity<SysSelect>(entity =>
            {
                entity.Property(e => e.Text)
                    .IsRequired()
                    .HasMaxLength(1000)
                    .IsUnicode(false);
            });

            modelBuilder.Entity<SysUser>(entity =>
            {
                entity.Property(e => e.Company).HasMaxLength(200);

                entity.Property(e => e.CreateDate).HasDefaultValueSql("('0001-01-01T00:00:00.0000000')");

                entity.Property(e => e.Email).HasMaxLength(200);

                entity.Property(e => e.LastLoginDate).HasDefaultValueSql("('0001-01-01T00:00:00.0000000')");

                entity.Property(e => e.Mobile).HasMaxLength(50);

                entity.Property(e => e.Name).HasMaxLength(50);

                entity.Property(e => e.Password).HasMaxLength(200);
            });

            modelBuilder.Entity<UfSjbaoxiaoren>(entity =>
            {
                entity.ToTable("uf_sjbaoxiaoren");

                entity.Property(e => e.Id).HasColumnName("id");

                entity.Property(e => e.Bh)
                    .HasColumnName("bh")
                    .HasMaxLength(200)
                    .IsUnicode(false);

                entity.Property(e => e.Csrq)
                    .HasColumnName("csrq")
                    .HasMaxLength(10)
                    .IsUnicode(false)
                    .IsFixedLength();

                entity.Property(e => e.Dh)
                    .HasColumnName("dh")
                    .HasMaxLength(200)
                    .IsUnicode(false);

                entity.Property(e => e.Dz)
                    .HasColumnName("dz")
                    .HasMaxLength(200)
                    .IsUnicode(false);

                entity.Property(e => e.Formmodeid).HasColumnName("formmodeid");

                entity.Property(e => e.Fzr)
                    .HasColumnName("fzr")
                    .HasMaxLength(200)
                    .IsUnicode(false);

                entity.Property(e => e.Fzrq)
                    .HasColumnName("fzrq")
                    .HasMaxLength(10)
                    .IsUnicode(false)
                    .IsFixedLength();

                entity.Property(e => e.Gh)
                    .HasColumnName("gh")
                    .HasMaxLength(200)
                    .IsUnicode(false);

                entity.Property(e => e.Grjzdz)
                    .HasColumnName("grjzdz")
                    .HasMaxLength(200)
                    .IsUnicode(false);

                entity.Property(e => e.Grmz)
                    .HasColumnName("grmz")
                    .HasMaxLength(20)
                    .IsUnicode(false);

                entity.Property(e => e.Gsfr)
                    .HasColumnName("gsfr")
                    .HasMaxLength(200)
                    .IsUnicode(false);

                entity.Property(e => e.Gsfzr)
                    .HasColumnName("gsfzr")
                    .HasMaxLength(200)
                    .IsUnicode(false);

                entity.Property(e => e.Hezlx).HasColumnName("hezlx");

                entity.Property(e => e.Hkxxbz)
                    .HasColumnName("hkxxbz")
                    .HasMaxLength(200)
                    .IsUnicode(false);

                entity.Property(e => e.Hkxxkhyh)
                    .HasColumnName("hkxxkhyh")
                    .HasMaxLength(200)
                    .IsUnicode(false);

                entity.Property(e => e.Hkxxzh)
                    .HasColumnName("hkxxzh")
                    .HasMaxLength(200)
                    .IsUnicode(false);

                entity.Property(e => e.Hkxxzhxz).HasColumnName("hkxxzhxz");

                entity.Property(e => e.Khh)
                    .HasColumnName("khh")
                    .HasMaxLength(200)
                    .IsUnicode(false);

                entity.Property(e => e.Khm)
                    .HasColumnName("khm")
                    .HasMaxLength(200)
                    .IsUnicode(false);

                entity.Property(e => e.Kplx).HasColumnName("kplx");

                entity.Property(e => e.Mc)
                    .HasColumnName("mc")
                    .HasMaxLength(200)
                    .IsUnicode(false);

                entity.Property(e => e.Modedatacreatedate)
                    .HasColumnName("modedatacreatedate")
                    .HasMaxLength(10)
                    .IsUnicode(false);

                entity.Property(e => e.Modedatacreater).HasColumnName("modedatacreater");

                entity.Property(e => e.Modedatacreatertype).HasColumnName("modedatacreatertype");

                entity.Property(e => e.Modedatacreatetime)
                    .HasColumnName("modedatacreatetime")
                    .HasMaxLength(8)
                    .IsUnicode(false);

                entity.Property(e => e.Modeuuid)
                    .HasColumnName("MODEUUID")
                    .HasMaxLength(100)
                    .IsUnicode(false);

                entity.Property(e => e.Qynf)
                    .HasColumnName("qynf")
                    .HasMaxLength(10)
                    .IsUnicode(false)
                    .IsFixedLength();

                entity.Property(e => e.RequestId).HasColumnName("requestId");

                entity.Property(e => e.Sczt).HasColumnName("sczt");

                entity.Property(e => e.Sh)
                    .HasColumnName("sh")
                    .HasMaxLength(200)
                    .IsUnicode(false);

                entity.Property(e => e.Xb).HasColumnName("xb");

                entity.Property(e => e.Xkbh)
                    .HasColumnName("xkbh")
                    .HasMaxLength(200)
                    .IsUnicode(false);

                entity.Property(e => e.Xkhzh)
                    .HasColumnName("xkhzh")
                    .HasMaxLength(200)
                    .IsUnicode(false);

                entity.Property(e => e.Xkzhxz).HasColumnName("xkzhxz");

                entity.Property(e => e.Yhkxxkh)
                    .HasColumnName("yhkxxkh")
                    .HasMaxLength(200)
                    .IsUnicode(false);

                entity.Property(e => e.Yhkxxkhh)
                    .HasColumnName("yhkxxkhh")
                    .HasMaxLength(200)
                    .IsUnicode(false);

                entity.Property(e => e.Yhkxxkhm)
                    .HasColumnName("yhkxxkhm")
                    .HasMaxLength(200)
                    .IsUnicode(false);

                entity.Property(e => e.Yhlh)
                    .HasColumnName("yhlh")
                    .HasMaxLength(200)
                    .IsUnicode(false);

                entity.Property(e => e.Yxq)
                    .HasColumnName("yxq")
                    .HasMaxLength(10)
                    .IsUnicode(false)
                    .IsFixedLength();

                entity.Property(e => e.Yycl)
                    .HasColumnName("yycl")
                    .HasMaxLength(10)
                    .IsUnicode(false)
                    .IsFixedLength();

                entity.Property(e => e.Yydj)
                    .HasColumnName("yydj")
                    .HasMaxLength(200)
                    .IsUnicode(false);

                entity.Property(e => e.Yyfw)
                    .HasColumnName("yyfw")
                    .HasMaxLength(200)
                    .IsUnicode(false);

                entity.Property(e => e.Yylx).HasColumnName("yylx");

                entity.Property(e => e.Yyqx)
                    .HasColumnName("yyqx")
                    .HasMaxLength(10)
                    .IsUnicode(false)
                    .IsFixedLength();

                entity.Property(e => e.Yyrq)
                    .HasColumnName("yyrq")
                    .HasMaxLength(10)
                    .IsUnicode(false)
                    .IsFixedLength();

                entity.Property(e => e.Yyzb).HasColumnName("yyzb");

                entity.Property(e => e.Yyzs)
                    .HasColumnName("yyzs")
                    .HasMaxLength(200)
                    .IsUnicode(false);

                entity.Property(e => e.Yyzz)
                    .HasColumnName("yyzz")
                    .HasColumnType("text");

                entity.Property(e => e.Yyzzbh)
                    .HasColumnName("yyzzbh")
                    .HasMaxLength(100)
                    .IsUnicode(false);

                entity.Property(e => e.Zgyhk).HasColumnName("zgyhk");

                entity.Property(e => e.Zh)
                    .HasColumnName("zh")
                    .HasMaxLength(200)
                    .IsUnicode(false);

                entity.Property(e => e.Zjh)
                    .HasColumnName("zjh")
                    .HasMaxLength(200)
                    .IsUnicode(false);

                entity.Property(e => e.Zjlx).HasColumnName("zjlx");

                entity.Property(e => e.Zpkhh)
                    .HasColumnName("zpkhh")
                    .HasMaxLength(200)
                    .IsUnicode(false);

                entity.Property(e => e.Zplxr)
                    .HasColumnName("zplxr")
                    .HasMaxLength(200)
                    .IsUnicode(false);

                entity.Property(e => e.Zpzh)
                    .HasColumnName("zpzh")
                    .HasMaxLength(200)
                    .IsUnicode(false);

                entity.Property(e => e.Zt).HasColumnName("zt");
            });

            modelBuilder.Entity<User>(entity =>
            {
                entity.HasNoKey();

                entity.Property(e => e.Id).ValueGeneratedOnAdd();

                entity.Property(e => e.Name).HasMaxLength(50);
            });

            OnModelCreatingPartial(modelBuilder);
        }

        partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
    }
}
